package com.atguigu.factory;

import java.util.Scanner;

/**
 * @ClassName OderPizza
 * @Description 披萨店
 * @Author HongJian-Yang
 * @Date 2020/6/16 23:38
 * @Version 1.0
 */
public class OderPizza {
    public OderPizza() {
        do {
            Pizza pizza = null;
            String orderType; // 类型
            orderType = getType();
            if (orderType.equals("CheesePizza")) {
                pizza = new CheesePizza();
                pizza.setName(orderType);
            } else if (orderType.equals("GreekPizza")) {
                pizza = new GreekPizza();
                pizza.setName(orderType);
            } else {
                break;
            }
            pizza.prepare();
            pizza.bake();
            pizza.cut();
            pizza.box();
        } while (true);
    }

    public String getType() {
        Scanner scanner = new Scanner(System.in);
        return scanner.next();
    }
}
